package com.ys.controller.api.hr;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ys.entity.hr.ThrOperateCompanyRatio;
import com.ys.service.hr.ThrOperateCompanyRatioService;
import com.ys.service.sys.CommonApiService;
import com.ys.vo.LayuiTableVoJA;
import com.ys.vo.R;

@Controller
@RequestMapping("/api/inter/thrOperateCompanyRatio")
public class ApiInterThrOperateCompanyRatioController {
	
	@Autowired
	private CommonApiService<ThrOperateCompanyRatio> commonApiService;
	@Autowired
	private ThrOperateCompanyRatioService thrOperateCompanyRatioService;
	

	@RequiresPermissions("thrOperateCompanyRatio:view")
	@RequestMapping("/search")
    @ResponseBody
	public LayuiTableVoJA search(Model model, HttpServletRequest request, HttpServletResponse response,
			@ModelAttribute ThrOperateCompanyRatio cond
			){
		
		cond.setOrderby("A.Id asc");
		
		return commonApiService.searchLay(cond);
	}
	
	/**
	 * 编辑
	 */
	@RequiresPermissions("thrOperateCompanyRatio:view")
	@PostMapping("/edit")
    @ResponseBody
	public R edit(HttpServletRequest request, @RequestParam Map<String, Object> params){
		try {
			return thrOperateCompanyRatioService.edit(params);
		} catch (Exception e) {
			e.printStackTrace();
			return R.error("系统正在开小差，请联系客服，我们将第一时间为您解决！");
		}
	}
	
}
